package cn.wolfcode.web.controller;

import cn.wolfcode.domain.Department;
import cn.wolfcode.domain.Employee;
import cn.wolfcode.domain.SystemDictionary;
import cn.wolfcode.qo.QueryObject;
import cn.wolfcode.service.ISystemDictionaryService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/dic")
public class SystemDictionaryController {
    @Autowired
    private ISystemDictionaryService systemDictionaryService;
    @RequestMapping("/list")
    public String selectForList(Model model, QueryObject qo){
        PageInfo<SystemDictionary> pageInfo = systemDictionaryService.selectForList(qo);
        model.addAttribute("pageInfo",pageInfo);

        return "/systemDictionary/list";


    }
    @RequestMapping("/saveOrUpdate")
    public String saveOrUpdate( SystemDictionary systemDictionary){
            if (systemDictionary.getId()!=null){
                systemDictionaryService.updateByPrimaryKey(systemDictionary);
            }else {
                systemDictionaryService.insert(systemDictionary);
            }
            return "redirect:/dic/list";
        }

}
